package com.ys.web.user.login;

import com.ys.base.BaseBean;
import com.ys.utils.base.j2se.StringHandler;
import com.ys.utils.spring.config.SystemError;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;

@Getter
@Setter
public class LoginInfo extends BaseBean {
    public String id;
    public String unionId;
    public String appId;
    public String openId;
    public String nickName;
    public String avatarUrl;
    public int gender;
    public String province;
    public String city;
    public String country;
    public String phone;
    public String appleId;
    public String password;
    public String salt;
    public String payPass;
    public String realName;
    public String realIdCard;
    public int realIdCardUp=1;
    public Boolean isBlack;
    public Date update_time;
    public Date create_time;
    public String friendId;
    public String friendDesc;
    public String friendRemark;
    public int accountStatus;
    public String alipayUid;
    public String alipayName;

    public int ysLevel;

    public long inviteUid;

    /**
     * 临时字段
     */
    // 红包金额 分
    public String amount;
    // 是否群创建人
    public String isCreater;
    // 群成员jid
    public String jid;
    // 红包领取时间
    public Date redTime;

    public String level;

    public String ip;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUnionId() {
        return unionId;
    }

    public void setUnionId(String unionId) {
        this.unionId = unionId;
    }

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getOpenId() {
        return openId;
    }

    public void setOpenId(String openId) {
        this.openId = openId;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public String getAvatarUrl() {
        return avatarUrl;
    }

    public void setAvatarUrl(String avatarUrl) {
        this.avatarUrl = avatarUrl;
    }

    public int getGender() {
        return gender;
    }

    public void setGender(int gender) {
        this.gender = gender;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getAppleId() {
        return appleId;
    }

    public void setAppleId(String appleId) {
        this.appleId = appleId;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

    public String getPayPass() {
        return payPass;
    }

    public void setPayPass(String payPass) {
        this.payPass = payPass;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public String getRealIdCard() {
        return realIdCard;
    }

    public void setRealIdCard(String realIdCard) {
        this.realIdCard = realIdCard;
    }

    public Boolean getBlack() {
        return isBlack;
    }

    public void setBlack(Boolean black) {
        isBlack = black;
    }

    public Date getUpdate_time() {
        return update_time;
    }

    public void setUpdate_time(Date update_time) {
        this.update_time = update_time;
    }

    public Date getCreate_time() {
        return create_time;
    }

    public void setCreate_time(Date create_time) {
        this.create_time = create_time;
    }

    public String getFriendId() {
        return friendId;
    }

    public void setFriendId(String friendId) {
        this.friendId = friendId;
    }

    public String getFriendDesc() {
        return friendDesc;
    }

    public void setFriendDesc(String friendDesc) {
        this.friendDesc = friendDesc;
    }

    public String getFriendRemark() {
        return friendRemark;
    }

    public void setFriendRemark(String friendRemark) {
        this.friendRemark = friendRemark;
    }

    public int getAccountStatus() {
        return accountStatus;
    }

    public void setAccountStatus(int accountStatus) {
        this.accountStatus = accountStatus;
    }

    public String getAmount() {
        return amount;
    }

    public void setAmount(String amount) {
        this.amount = amount;
    }

    public String getIsCreater() {
        return isCreater;
    }

    public void setIsCreater(String isCreater) {
        this.isCreater = isCreater;
    }

    public String getJid() {
        return jid;
    }

    public void setJid(String jid) {
        this.jid = jid;
    }

    public Date getRedTime() {
        return redTime;
    }

    public void setRedTime(Date redTime) {
        this.redTime = redTime;
    }

    public String getLevel() {
        return level;
    }

    public void setLevel(String level) {
        this.level = level;
    }


    public long getInviteUid() {
        return inviteUid;
    }

    public void setInviteUid(long inviteUid) {
        this.inviteUid = inviteUid;
    }

    public void checkNull() {
        if(StringHandler.isEmpty(this.nickName)){
            this.nickName = "";
        }
        if(StringHandler.isEmpty(this.avatarUrl)){
            this.avatarUrl = "";
        }
    }

    public void checkStatus(){
        if(this.accountStatus==2){
            SystemError.wrapBs("500", "您的账号已禁用，操作失败");
        }
        if(this.accountStatus==1){
            SystemError.wrapBs("500", "您的账号已注销，操作失败");
        }
    }
}